﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace RaProWorld
{
    class Ltan_item
    {
        public Texture2D sprite;
        public Vector2 position;
        public Rectangle hitbox;
        public bool available;

        public Ltan_item(Texture2D newSprite) 
        {
            sprite = newSprite;
            position = new Vector2((float)1024.0f + (sprite.Width / 2), (float)675.0f - (sprite.Height / 2));
            hitbox = new Rectangle((int)position.X-(sprite.Width/2),(int)position.Y-(sprite.Height/2), sprite.Width, sprite.Height);
            available = true;
            
        }

        public void update(GameTime gameTime,bool scrolling,float speed) 
        {
            if (scrolling&&available) 
            {
                position.X = position.X - speed;
                hitbox.X = (int)position.X-(sprite.Width/2);
            }
        }

        public void draw(SpriteBatch spriteBatch, GameTime gameTime) 
        {
            spriteBatch.Draw(sprite,
                position,
                null,
                Color.White,
                0.0f,
                new Vector2(sprite.Width / 2, sprite.Height / 2),
                1.0f,
                SpriteEffects.None,
                0);
        }
    }
}
